- Author:
- Soroush Safaei <ssaf006@aucklanduni.ac.nz>
- Date:
- 2017-06-18 14:33:01+12:00
- Desc:
-
adding momentum
- Permanent Source URI:
- https://models.fieldml.org/workspace/43b/rawfile/a8af5c258bce90218417d3e8a42a86a4c490253d/BG Tutorial Mechanical Systems/Pendulum_Double.cellml
<?xml version='1.0'?>
<model name="DoublePendulum" xmlns="http://www.cellml.org/cellml/1.1#" xmlns:cellml="http://www.cellml.org/cellml/1.1#" xmlns:xlink="http://www.w3.org/1999/xlink">
<import xlink:href="Units.cellml">
<units name="m_per_s" units_ref="m_per_s"/>
<units name="m_per_s2" units_ref="m_per_s2"/>
<units name="rad_per_s" units_ref="rad_per_s"/>
<units name="rad_per_s2" units_ref="rad_per_s2"/>
<units name="J_per_m" units_ref="J_per_m"/>
<units name="J_per_m2" units_ref="J_per_m2"/>
<units name="J_s_per_rad" units_ref="J_s_per_rad"/>
<units name="J_s_per_m" units_ref="J_s_per_m"/>
<units name="J_s_per_m2" units_ref="J_s_per_m2"/>
<units name="J_s2_per_m2" units_ref="J_s2_per_m2"/>
</import>
<component name="control">
<variable initial_value="90" name="q_theta_1" public_interface="out" units="dimensionless"/>
<variable initial_value="90" name="q_theta_2" public_interface="out" units="dimensionless"/>
<variable initial_value="1.0" name="l_1" public_interface="out" units="metre"/>
<variable initial_value="1.0" name="l_2" public_interface="out" units="metre"/>
<variable initial_value="1.0" name="I_1" public_interface="out" units="J_s2_per_m2"/>
<variable initial_value="1.0" name="I_2" public_interface="out" units="J_s2_per_m2"/>
<variable name="q_x_1_tmp" public_interface="in" units="metre"/>
<variable name="q_y_1_tmp" public_interface="in" units="metre"/>
<variable name="q_xc_1_tmp" public_interface="in" units="metre"/>
<variable name="q_yc_1_tmp" public_interface="in" units="metre"/>
<variable name="q_x_2_tmp" public_interface="in" units="metre"/>
<variable name="q_y_2_tmp" public_interface="in" units="metre"/>
<variable name="q_xc_2_tmp" public_interface="in" units="metre"/>
<variable name="q_yc_2_tmp" public_interface="in" units="metre"/>
<variable name="q_x_3_tmp" public_interface="in" units="metre"/>
<variable name="q_y_3_tmp" public_interface="in" units="metre"/>
<variable name="q_x_1" public_interface="out" units="metre"/>
<variable name="q_y_1" public_interface="out" units="metre"/>
<variable name="q_xc_1" public_interface="out" units="metre"/>
<variable name="q_yc_1" public_interface="out" units="metre"/>
<variable name="q_x_2" public_interface="out" units="metre"/>
<variable name="q_y_2" public_interface="out" units="metre"/>
<variable name="q_xc_2" public_interface="out" units="metre"/>
<variable name="q_yc_2" public_interface="out" units="metre"/>
<variable name="q_x_3" public_interface="out" units="metre"/>
<variable name="q_y_3" public_interface="out" units="metre"/>
<variable name="t" public_interface="out" units="second"/>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<eq/>
<ci>q_x_1</ci>
<ci>q_x_1_tmp</ci>
</apply>
<apply>
<eq/>
<ci>q_y_1</ci>
<ci>q_y_1_tmp</ci>
</apply>
<apply>
<eq/>
<ci>q_xc_1</ci>
<apply>
<plus/>
<ci>q_xc_1_tmp</ci>
<ci>l_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>q_yc_1</ci>
<apply>
<plus/>
<ci>q_yc_1_tmp</ci>
<ci>l_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>q_x_2</ci>
<apply>
<plus/>
<ci>q_x_2_tmp</ci>
<ci>l_1</ci>
<ci>l_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>q_y_2</ci>
<apply>
<plus/>
<ci>q_y_2_tmp</ci>
<ci>l_1</ci>
<ci>l_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>q_xc_2</ci>
<apply>
<plus/>
<ci>q_xc_2_tmp</ci>
<ci>l_1</ci>
<ci>l_1</ci>
<ci>l_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>q_yc_2</ci>
<apply>
<plus/>
<ci>q_yc_2_tmp</ci>
<ci>l_1</ci>
<ci>l_1</ci>
<ci>l_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>q_x_3</ci>
<apply>
<plus/>
<ci>q_x_3_tmp</ci>
<ci>l_1</ci>
<ci>l_1</ci>
<ci>l_2</ci>
<ci>l_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>q_y_3</ci>
<apply>
<plus/>
<ci>q_y_3_tmp</ci>
<ci>l_1</ci>
<ci>l_1</ci>
<ci>l_2</ci>
<ci>l_2</ci>
</apply>
</apply>
</math>
</component>
<component name="pendulum">
<variable name="t" public_interface="in" units="second"/>
<!--State variables-->
<variable name="q_theta_1" public_interface="in" units="dimensionless"/>
<variable name="q_theta_2" public_interface="in" units="dimensionless"/>
<variable initial_value="0" name="q_x_1" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_y_1" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_xc_1" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_yc_1" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_x_2" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_y_2" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_xc_2" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_yc_2" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_x_3" public_interface="out" units="metre"/>
<variable initial_value="0" name="q_y_3" public_interface="out" units="metre"/>
<variable name="v_theta_1" units="rad_per_s"/>
<variable name="v_theta_2" units="rad_per_s"/>
<variable initial_value="0" name="v_x_1" units="m_per_s"/>
<variable initial_value="0" name="v_y_1" units="m_per_s"/>
<variable name="v_xc_1" units="m_per_s"/>
<variable name="v_yc_1" units="m_per_s"/>
<variable name="v_x_2" units="m_per_s"/>
<variable name="v_y_2" units="m_per_s"/>
<variable name="v_xc_2" units="m_per_s"/>
<variable name="v_yc_2" units="m_per_s"/>
<variable name="v_x_3" units="m_per_s"/>
<variable name="v_y_3" units="m_per_s"/>
<variable name="v_1" units="m_per_s"/>
<variable name="v_2" units="m_per_s"/>
<variable name="v_3" units="m_per_s"/>
<variable name="v_4" units="m_per_s"/>
<variable name="v_5" units="m_per_s"/>
<variable name="v_6" units="m_per_s"/>
<variable name="v_7" units="m_per_s"/>
<variable name="v_8" units="m_per_s"/>
<variable initial_value="0" name="p_theta_1" units="J_s_per_rad"/>
<variable initial_value="0" name="p_theta_2" units="J_s_per_rad"/>
<variable name="p_xc_1" units="J_s_per_m"/>
<variable name="p_yc_1" units="J_s_per_m"/>
<variable name="p_xc_2" units="J_s_per_m"/>
<variable name="p_yc_2" units="J_s_per_m"/>
<variable name="u_x_1" units="J_per_m"/>
<variable name="u_y_1" units="J_per_m"/>
<variable initial_value="0" name="u_xc_1" units="J_per_m"/>
<variable initial_value="0" name="u_yc_1" units="J_per_m"/>
<variable name="u_x_2" units="J_per_m"/>
<variable name="u_y_2" units="J_per_m"/>
<variable initial_value="0" name="u_xc_2" units="J_per_m"/>
<variable initial_value="0" name="u_yc_2" units="J_per_m"/>
<variable initial_value="0" name="u_x_3" units="J_per_m"/>
<variable initial_value="0" name="u_y_3" units="J_per_m"/>
<variable name="u_theta_1" units="J_per_m"/>
<variable name="u_theta_2" units="J_per_m"/>
<variable name="u_1" units="joule"/>
<variable name="u_2" units="joule"/>
<variable name="u_3" units="joule"/>
<variable name="u_4" units="joule"/>
<variable name="u_5" units="joule"/>
<variable name="u_6" units="joule"/>
<variable name="u_7" units="joule"/>
<variable name="u_8" units="joule"/>
<variable initial_value="10" name="u_g_1" units="joule"/>
<variable initial_value="10" name="u_g_2" units="joule"/>
<!--Constitutive parameters-->
<variable name="l_1" public_interface="in" units="metre"/>
<variable name="l_2" public_interface="in" units="metre"/>
<variable name="I_1" public_interface="in" units="J_s2_per_m2"/>
<variable name="I_2" public_interface="in" units="J_s2_per_m2"/>
<!--Conservation laws-->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_theta_1</ci>
</apply>
<apply>
<times/>
<apply>
<divide/>
<cn cellml:units="dimensionless">180</cn>
<pi/>
</apply>
<ci>v_theta_1</ci>
</apply>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_theta_2</ci>
</apply>
<apply>
<times/>
<apply>
<divide/>
<cn cellml:units="dimensionless">180</cn>
<pi/>
</apply>
<ci>v_theta_2</ci>
</apply>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_x_1</ci>
</apply>
<ci>v_x_1</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_y_1</ci>
</apply>
<ci>v_y_1</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_xc_1</ci>
</apply>
<ci>v_xc_1</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_yc_1</ci>
</apply>
<ci>v_yc_1</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_x_2</ci>
</apply>
<ci>v_x_2</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_y_2</ci>
</apply>
<ci>v_y_2</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_xc_2</ci>
</apply>
<ci>v_xc_2</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_yc_2</ci>
</apply>
<ci>v_yc_2</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_x_3</ci>
</apply>
<ci>v_x_3</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>q_y_3</ci>
</apply>
<ci>v_y_3</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>p_theta_1</ci>
</apply>
<ci>u_theta_1</ci>
</apply>
<apply>
<eq/>
<apply>
<diff/>
<bvar>
<ci>t</ci>
</bvar>
<ci>p_theta_2</ci>
</apply>
<ci>u_theta_2</ci>
</apply>
<apply>
<eq/>
<ci>v_xc_1</ci>
<apply>
<plus/>
<ci>v_x_1</ci>
<ci>v_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_xc_1</ci>
<apply>
<minus/>
<ci>v_x_2</ci>
<ci>v_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_yc_1</ci>
<apply>
<plus/>
<ci>v_y_1</ci>
<ci>v_3</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_yc_1</ci>
<apply>
<minus/>
<ci>v_y_2</ci>
<ci>v_4</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_xc_2</ci>
<apply>
<plus/>
<ci>v_x_2</ci>
<ci>v_5</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_xc_2</ci>
<apply>
<minus/>
<ci>v_x_3</ci>
<ci>v_6</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_yc_2</ci>
<apply>
<plus/>
<ci>v_y_2</ci>
<ci>v_7</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_yc_2</ci>
<apply>
<minus/>
<ci>v_y_3</ci>
<ci>v_8</ci>
</apply>
</apply>
<!--Constitutive relations-->
<apply>
<eq/>
<ci>u_theta_1</ci>
<apply>
<minus/>
<apply>
<plus/>
<ci>u_1</ci>
<ci>u_2</ci>
<ci>u_3</ci>
<ci>u_4</ci>
</apply>
</apply>
</apply>
<apply>
<eq/>
<ci>u_theta_2</ci>
<apply>
<minus/>
<apply>
<plus/>
<ci>u_5</ci>
<ci>u_6</ci>
<ci>u_7</ci>
<ci>u_8</ci>
</apply>
</apply>
</apply>
<apply>
<eq/>
<ci>u_xc_1</ci>
<apply>
<minus/>
<ci>u_x_1</ci>
<ci>u_x_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_yc_1</ci>
<apply>
<minus/>
<apply>
<minus/>
<ci>u_y_1</ci>
<ci>u_y_2</ci>
</apply>
<ci>u_g_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_xc_2</ci>
<apply>
<minus/>
<ci>u_x_2</ci>
<ci>u_x_3</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_yc_2</ci>
<apply>
<minus/>
<apply>
<minus/>
<ci>u_y_2</ci>
<ci>u_y_3</ci>
</apply>
<ci>u_g_2</ci>
</apply>
</apply>
<!--Constitutive relations-->
<apply>
<eq/>
<ci>v_theta_1</ci>
<apply>
<divide/>
<ci>p_theta_1</ci>
<apply>
<divide/>
<apply>
<times/>
<ci>I_1</ci>
<apply>
<power/>
<ci>l_1</ci>
<cn cellml:units="dimensionless">2</cn>
</apply>
</apply>
<cn cellml:units="dimensionless">3</cn>
</apply>
</apply>
</apply>
<apply>
<eq/>
<ci>v_theta_2</ci>
<apply>
<divide/>
<ci>p_theta_2</ci>
<apply>
<divide/>
<apply>
<times/>
<ci>I_2</ci>
<apply>
<power/>
<ci>l_2</ci>
<cn cellml:units="dimensionless">2</cn>
</apply>
</apply>
<cn cellml:units="dimensionless">3</cn>
</apply>
</apply>
</apply>
<apply>
<eq/>
<ci>v_xc_1</ci>
<apply>
<divide/>
<ci>p_xc_1</ci>
<ci>I_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_yc_1</ci>
<apply>
<divide/>
<ci>p_yc_1</ci>
<ci>I_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_xc_2</ci>
<apply>
<divide/>
<ci>p_xc_2</ci>
<ci>I_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_yc_2</ci>
<apply>
<divide/>
<ci>p_yc_2</ci>
<ci>I_2</ci>
</apply>
</apply>
<!--Transformations-->
<apply>
<eq/>
<ci>v_1</ci>
<apply>
<times/>
<ci>l_1</ci>
<apply>
<cos/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_1</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>v_theta_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_2</ci>
<apply>
<times/>
<ci>l_1</ci>
<apply>
<cos/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_1</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>v_theta_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_3</ci>
<apply>
<times/>
<ci>l_1</ci>
<apply>
<sin/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_1</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>v_theta_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_4</ci>
<apply>
<times/>
<ci>l_1</ci>
<apply>
<sin/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_1</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>v_theta_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_1</ci>
<apply>
<times/>
<ci>l_1</ci>
<apply>
<cos/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_1</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>u_x_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_2</ci>
<apply>
<times/>
<ci>l_1</ci>
<apply>
<cos/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_1</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>u_x_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_3</ci>
<apply>
<times/>
<ci>l_1</ci>
<apply>
<sin/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_1</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>u_y_1</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_4</ci>
<apply>
<times/>
<ci>l_1</ci>
<apply>
<sin/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_1</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>u_y_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_5</ci>
<apply>
<times/>
<ci>l_2</ci>
<apply>
<cos/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_2</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>v_theta_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_6</ci>
<apply>
<times/>
<ci>l_2</ci>
<apply>
<cos/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_2</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>v_theta_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_7</ci>
<apply>
<times/>
<ci>l_2</ci>
<apply>
<sin/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_2</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>v_theta_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>v_8</ci>
<apply>
<times/>
<ci>l_2</ci>
<apply>
<sin/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_2</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>v_theta_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_5</ci>
<apply>
<times/>
<ci>l_2</ci>
<apply>
<cos/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_2</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>u_x_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_6</ci>
<apply>
<times/>
<ci>l_2</ci>
<apply>
<cos/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_2</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>u_x_3</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_7</ci>
<apply>
<times/>
<ci>l_2</ci>
<apply>
<sin/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_2</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>u_y_2</ci>
</apply>
</apply>
<apply>
<eq/>
<ci>u_8</ci>
<apply>
<times/>
<ci>l_2</ci>
<apply>
<sin/>
<apply>
<times/>
<apply>
<divide/>
<ci>q_theta_2</ci>
<cn cellml:units="dimensionless">180</cn>
</apply>
<pi/>
</apply>
</apply>
<ci>u_y_3</ci>
</apply>
</apply>
</math>
</component>
<connection>
<map_components component_1="control" component_2="pendulum"/>
<map_variables variable_1="t" variable_2="t"/>
<map_variables variable_1="q_theta_1" variable_2="q_theta_1"/>
<map_variables variable_1="q_theta_2" variable_2="q_theta_2"/>
<map_variables variable_1="l_1" variable_2="l_1"/>
<map_variables variable_1="l_2" variable_2="l_2"/>
<map_variables variable_1="I_1" variable_2="I_1"/>
<map_variables variable_1="I_2" variable_2="I_2"/>
<map_variables variable_1="q_x_1_tmp" variable_2="q_x_1"/>
<map_variables variable_1="q_y_1_tmp" variable_2="q_y_1"/>
<map_variables variable_1="q_xc_1_tmp" variable_2="q_xc_1"/>
<map_variables variable_1="q_yc_1_tmp" variable_2="q_yc_1"/>
<map_variables variable_1="q_x_2_tmp" variable_2="q_x_2"/>
<map_variables variable_1="q_y_2_tmp" variable_2="q_y_2"/>
<map_variables variable_1="q_xc_2_tmp" variable_2="q_xc_2"/>
<map_variables variable_1="q_yc_2_tmp" variable_2="q_yc_2"/>
<map_variables variable_1="q_x_3_tmp" variable_2="q_x_3"/>
<map_variables variable_1="q_y_3_tmp" variable_2="q_y_3"/>
</connection>
</model>